import request from '../index';

const marketUrl = '/marketing-server';

// 分页查询优惠券实体
export const pagingEntity = (params: any, page: any) => {
  return request({
    url: `${marketUrl}/app/coupon/pagingEntity`,
    params: params,
    extraParams: page,
    noLoading: true,
  });
};

//获取优惠券实体详情
export const getEntityById = (params: any) => {
  return request({
    url: `${marketUrl}/app/coupon/getEntityById`,
    params: params,
  });
};

// 查询可用优惠券
export const getAvailableEntity = (params: any) => {
  return request({
    url: `${marketUrl}/app/coupon/getAvailableEntity`,
    params: params,
  });
};

// 获取用户活动详情
export const getActivityById = (params: any) => {
  return request({
    url: `${marketUrl}/userActivity/getActivityById`,
    params: params,
  });
};

// 获取用户活动
export const queryUserActivity = (params: any) => {
  return request({
    url: `${marketUrl}/app/userActivity/queryUserActivity`,
    params: params,
  });
};

// 参加分享活动/扫码领券活动
export const joinActivity = (params: any, flag: boolean = true) => {
  return request({
    url: `${marketUrl}/app/userActivity/joinActivity`,
    params: params,
    noToast: flag,
  });
};

// 组团充电活动开团校验
export const buildTeamCheck = (params: any) => {
  return request({
    url: `${marketUrl}/app/userActivity/buildTeamCheck`,
    params: params,
  });
};

// 组团充电活动开团
export const buildTeam = (params: any) => {
  return request({
    url: `${marketUrl}/app/userActivity/buildTeam`,
    params: params,
  });
};

// 参加组团充电活动入团校验
export const joinTeamCheck = (params: any) => {
  return request({
    url: `${marketUrl}/app/userActivity/joinTeamCheck`,
    params: params,
  });
};

// 参加组团充电活动
export const joinTeam = (params: any) => {
  return request({
    url: `${marketUrl}/app/userActivity/joinTeam`,
    params: params,
  });
};

// 查询成团进展
export const getTeamById = (params: any) => {
  return request({
    url: `${marketUrl}/app/userActivity/getTeamById`,
    params: params,
  });
};

// 分页查询参团历史
export const pagingMember = (params: any, extraParams: any) => {
  return request({
    url: `${marketUrl}/app/userActivity/pagingMember`,
    params: params,
    extraParams,
  });
};
